home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / sb_box.c < prev    next >
C/C++ Source or Header  |  1989-01-01  |  6KB  |  117 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*              Box Drawing subroutines for BinkleyTerm 2.10                */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*   This module is derived from code developed by Augie Hansen in his      */
  46. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  47. /*   kind enough to give us verbal permission to use his routines, and      */
  48. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  49. /*   If you decide to use this code in some package you are doing, give     */
  50. /*   some thought to going out and buying the book. He deserves that.       */
  51. /*                                                                          */
  52. /*--------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "sbuf.h"
  56. #include "video.h"
  57. #include "box.h"
  58. #include "com.h"
  59. #include "xfer.h"
  60. #include "zmodem.h"
  61. #include "keybd.h"
  62. #include "sched.h"
  63. #include "externs.h"
  64. #include "prototyp.h"
  65.  
  66. static BOXTYPE box[] = {
  67.    '+'  , '+'  , '+'  , '+'  , '-'  , '-'  , '|'  , '|'  ,
  68.    ULC11, URC11, LLC11, LRC11, HBAR1, HBAR1, VBAR1, VBAR1,
  69.    ULC22, URC22, LLC22, LRC22, HBAR2, HBAR2, VBAR2, VBAR2,
  70.    ULC12, URC12, LLC12, LRC12, HBAR1, HBAR1, VBAR2, VBAR2,
  71.    ULC21, URC21, LLC21, LRC21, HBAR2, HBAR2, VBAR1, VBAR1,
  72.    BLOCK, BLOCK, BLOCK, BLOCK, HBART, HBARB, BLOCK, BLOCK
  73. };
  74.  
  75. int sb_box (win, type, attr)
  76. REGIONP win;
  77. int type;
  78. unsigned char attr;
  79. {
  80.    register int r;
  81.    int x;
  82.    int maxr, maxc;
  83.    BOXTYPE *boxp;
  84.  
  85.    boxp = &box[type];
  86.    maxc = win->c1 - win->c0;
  87.    maxr = win->r1 - win->r0;
  88.    x = maxc - 1;
  89.  
  90.    /* draw top row */
  91.    sb_move (win, 0, 0);
  92.    sb_wca (win, boxp->ul, attr, 1);
  93.    sb_move (win, 0, 1);
  94.    sb_wca (win, boxp->tbar, attr, x);
  95.    sb_move (win, 0, maxc);
  96.    sb_wca (win, boxp->ur, attr, 1);
  97.  
  98.    /* draw left and right sides */
  99.    for (r = 1; r < maxr; r++)
  100.       {
  101.       sb_move (win, r, 0);
  102.       sb_wca (win, boxp->lbar, attr, 1);
  103.       sb_move (win, r, maxc);
  104.       sb_wca (win, boxp->rbar, attr, 1);
  105.       }
  106.  
  107.    /* draw bottom row */
  108.    sb_move (win, maxr, 0);
  109.    sb_wca (win, boxp->ll, attr, 1);
  110.    sb_move (win, maxr, 1);
  111.    sb_wca (win, boxp->bbar, attr, x);
  112.    sb_move (win, maxr, maxc);
  113.    sb_wca (win, boxp->lr, attr, 1);
  114.  
  115.    return (SB_OK);
  116. }
  117.